			var xmlhtttp;
			function loadXMLDoc(url){
				xmlhtttp = null;
				if (window.XMLHttpRequest){
				// code for Firefox, Opera, IE7, etc.
				  xmlhttp=new XMLHttpRequest();
				}
				else if (window.ActiveXObject){
				// code for IE6, IE5
				  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				if (xmlhttp!=null){
				  xmlhttp.onreadystatechange=state_Change;
				  xmlhttp.open("GET",url,true);
				  xmlhttp.send(null);
				}
				else{
				  alert("Your browser does not support XMLHTTP.");
				}
			}
			
			function state_Change(){
				if (xmlhttp.readyState==4){
				// 4 = "loaded"
				  if (xmlhttp.status==200){
				// 200 = "OK"
					var classdata = JSON.parse(xmlhttp.responseText);
					//console.log(classdata.data);
					var names = [];
					var values = [];
					for(var i in classdata.data){
						names.push(classdata.data[i].name);
						values.push(classdata.data[i].value);
					}
					
					// 基于准备好的dom，初始化echarts实例
					var pieChart = echarts.init(document.getElementById('pie'));
									
					var pieOption = {
									color: ['#c23531','#2f4554', '#61a0a8', '#d48265', '#91c7ae','#749f83',  '#ca8622', '#bda29a','#6e7074', '#546570', '#c4ccd3'],
									title: {
										text: '客户价值分类饼图',
										x:'center',
										y:'5%'
									},
									tooltip: {
										formatter: "{b} : {d}%",
										position: function (point, params, dom, rect, size) {
													  // 鼠标坐标和提示框位置的参考坐标系是：以外层div的左上角那一点为原点，x轴向右，y轴向下
													  // 提示框位置
													  var x = 0; // x坐标位置
													  var y = 0; // y坐标位置
													 
													  // 当前鼠标位置
													  var pointX = point[0];
													  var pointY = point[1];
													 
													  // 外层div大小
													  // var viewWidth = size.viewSize[0];
													  // var viewHeight = size.viewSize[1];
													 
													  // 提示框大小
													  var boxWidth = size.contentSize[0];
													  var boxHeight = size.contentSize[1];
													 
													  // boxWidth > pointX 说明鼠标左边放不下提示框
													  if (boxWidth > pointX) {
														x = 5;
													  } else { // 左边放的下
														x = pointX - boxWidth;
													  }
													 
													  // boxHeight > pointY 说明鼠标上边放不下提示框
													  if (boxHeight > pointY) {
														y = 5;
													  } else { // 上边放得下
														y = pointY - boxHeight;
													  }
													 
													  return [x, y];
												}										
										},
									series: [
												{
												type: 'pie',
												radius: '65%',
												data: classdata.data
											}
										]
									};
									
					pieChart.setOption(pieOption)
					
					var histogram = echarts.init(document.getElementById('histogram'));
					
					var histOption = {
									color: ['#c23531','#2f4554', '#61a0a8', '#d48265', '#91c7ae','#749f83',  '#ca8622', '#bda29a','#6e7074', '#546570', '#c4ccd3'],
									title: {
										text: '客户价值分类柱状图',
										x:'center'
										
									},
									tooltip: {
										position: function (point, params, dom, rect, size) {
													  // 鼠标坐标和提示框位置的参考坐标系是：以外层div的左上角那一点为原点，x轴向右，y轴向下
													  // 提示框位置
													  var x = 0; // x坐标位置
													  var y = 0; // y坐标位置
													 
													  // 当前鼠标位置
													  var pointX = point[0];
													  var pointY = point[1];
													 
													  // 外层div大小
													  // var viewWidth = size.viewSize[0];
													  // var viewHeight = size.viewSize[1];
													 
													  // 提示框大小
													  var boxWidth = size.contentSize[0];
													  var boxHeight = size.contentSize[1];
													 
													  // boxWidth > pointX 说明鼠标左边放不下提示框
													  if (boxWidth > pointX) {
														x = 5;
													  } else { // 左边放的下
														x = pointX - boxWidth;
													  }
													 
													  // boxHeight > pointY 说明鼠标上边放不下提示框
													  if (boxHeight > pointY) {
														y = 5;
													  } else { // 上边放得下
														y = pointY - boxHeight;
													  }
													 
													  return [x, y];
												}										
										},
										xAxis: {
														data: names
													},
										yAxis: {},
										series: [{
														type: 'bar',
														data: values
													}]
					}
					histogram.setOption(histOption);
					
				  }
				  else{
					alert("Problem retrieving data:" + xmlhttp.statusText);
				  }
				}
			}